<div [@routerTransition]>
    <div class="m-subheader">
        <div class="row align-items-center">
            <div class="mr-auto col-auto">
                <h3 class="m-subheader__title">
                    <span>工装丢失台帐管理</span>
                </h3>
            </div>
            <div class="col text-right mt-3 mt-md-0"></div>
        </div>
    </div>
    <div class="m-content">
        <div class="m-portlet m-portlet--mobile">
            <div class="m-portlet__body">
                <div class="primeng-datatable-container" [busyIf]="primengTableHelper.isLoading">
                    <form class="horizontal-form" autocomplete="off">
                        <div class="m-form m-form--label-align-right">
                            <div class="row">
                                <div class="col-md-11">
                                    <div class="row align-items-center">

                                        <div class="input-width">
                                            <div class="form-group m-form__group row">
                                                <label class="col-4 col-form-label" for="Search_MaterialName">工装编号:</label>
                                                <div class="col-8">
                                                    <input type="text" class="form-control m-input" name="Search_MaterialName"
                                                           id="Search_MaterialName" [(ngModel)]="materialCodeFilter" />
                                                </div>
                                            </div>
                                        </div>
                                        <div class="input-width">
                                            <div class="form-group m-form__group row">
                                                <label class="col-4 col-form-label" for="Search_Dept">工装名称:</label>
                                                <div class="col-8">
                                                    <input type="text" class="form-control m-input" name="Search_Dept"
                                                           id="Search_Dept" [(ngModel)]="billcode" />
                                                </div>
                                            </div>
                                        </div>
                                        <div class="form-group m-form__group row">
                                            <label class="col-4 col-form-label" for="Search_DrawingNum">规格</label>
                                            <div class="col-8">
                                                <input type="text"
                                                       class="form-control m-input"
                                                       name="Search_Specification"
                                                       id="Search_Specification"
                                                       [(ngModel)]="f_Specification" />
                                            </div>
                                        </div>
                                        <div class="form-group m-form__group row">
                                            <label class="col-4 col-form-label" for="Search_DrawingNum">工装图号:</label>
                                            <div class="col-8">
                                                <input type="text"
                                                       class="form-control m-input"
                                                       name="Search_TradeMark"
                                                       id="Search_TradeMark"
                                                       [(ngModel)]="f_CAL_ToolingPictureId" />
                                            </div>
                                        </div>

                                        <div class="form-group m-form__group row">
                                            <label class="col-4 col-form-label" for="Search_DrawingNum">产品型号:</label>
                                            <div class="col-8">
                                                <input type="text"
                                                       class="form-control m-input"
                                                       name="Search_Precision"
                                                       id="Search_Precision"
                                                       [(ngModel)]="f_CAL_ProductModel" />
                                            </div>
                                        </div>
                                        <!-- <div class="input-width">
                                            <div class="form-group m-form__group row">
                                                <label class="col-4 col-form-label" for="Search_DrawingNum">序列号:</label>
                                                <div class="col-8">
                                                    <input type="text" class="form-control m-input" name="Search_Precision" id="Search_Precision" [(ngModel)]="f_SeriousNum" />
                                                </div>
                                            </div>
                                        </div> -->
                                        <div class="input-width">
                                            <div class="form-group m-form__group row">
                                                <label class="col-4 col-form-label" for="warehouseNameFilter">仓库:</label>
                                                <div class="col-8">
                                                    <camc-multiSelect class="float-left"
                                                                      id="warehouseNameFilter"
                                                                      [options]="roomOption"
                                                                      name="tabdle"
                                                                      [(ngModel)]="selectedWareHouse"
                                                                      [style]="{ width: '220px' }"
                                                                      styleClass="form-control"
                                                                      defaultLabel="选择仓库"
                                                                      maxSelectedLabels="1"
                                                                      selectedItemsLabel="已选择{0}个仓库">
                                                    </camc-multiSelect>
                                                </div>
                                            </div>
                                            <!--<div class="input-width">
                                                <div class="form-group m-form__group row">
                                                    <label class="col-4 col-form-label" for="Search_Dept">部门:</label>
                                                    <div class="col-8">
                                                        <camc-multiSelect class="float-left" id="userDataPermissions"
                                                                          [options]="userDataPermissions" name="table" [(ngModel)]="selectedDepts"
                                                                          [style]="{ width: '220px'}" styleClass="form-control"
                                                                          defaultLabel="选择部门" maxSelectedLabels="5" selectedItemsLabel="已选择 {0} 个部门">
                                                        </camc-multiSelect>
                                                    </div>
                                                </div>
                                            </div>-->
                                        </div>

                                        <!--<div style="width: 20%;">
                                            <div class="input-width">
                                                <div class="form-group m-form__group row">
                                                    <label class="col-4 col-form-label" for="Search_MaterialName">单据状态:</label>
                                                    <div class="col-8">
                                                        <camc-dropdown-auto [options]="billStatusOptions" name="billstatus"
                                                                            [(ngModel)]="billstatus" class="float-left width-percent-100">
                                                        </camc-dropdown-auto>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>-->
                                    </div>
                                </div>
                                <div class="col-md-1 m--align-right">
                                    <button (click)="getAccounts()" class="btn btn-primary m--margin-top-40" type="button">
                                        <i class="flaticon-search-1" [attr.aria-label]="l('Search')"></i>查询
                                    </button>
                                </div>
                            </div>
                        </div>
                    </form>

                    <hr />

                    <div class="row align-items-center">
                        <div class="col-md-6">
                            <h4 class="m-subheader__title">丢失台帐信息</h4>
                        </div>
                        <div class="col-md-6 m--align-right">
                            <div class="btn-group m-btn-
                            " role="group" aria-label="...">
                                <!-- <button [disabled]="!selectedAccounts" type="button" class="btn btn-default m--padding-left-5 m--padding-right-5"
                                    (click)="baseFieldDetailModal.showinfo(selectedAccounts.id,_type)" *ngIf="permission.isGranted('Pages.Tooling.BaseInfo.Detail')">
                                    详细信息
                                </button> -->
                                <!-- <button *ngIf="permission.isGranted('Pages.Stock.Account.Out')" type="button" class="btn btn-default m--padding-left-5 m--padding-right-5"
                                        (click)="simpleAccountBaseInfoModal.show()" [disabled]="selectedAccounts?.length < 1">
                                        工装借用
                                    </button>

                                    <button *ngIf="permission.isGranted('Pages.Stock.Account.Out')" type="button" class="btn btn-default m--padding-left-5 m--padding-right-5"
                                        [disabled]="selectedAccounts?.length < 1" (click)="createOrEditInventoryBillModal.addAccoutInfo(selectedAccounts)">
                                        工装归还
                                    </button>
                                    <button *ngIf="permission.isGranted('Pages.Stock.Account.Record')" type="button" class="btn btn-default m--padding-left-5 m--padding-right-5"
                                        (click)="accountRecordModal.show(selectedAccounts[0])" [disabled]="selectedAccounts?.length != 1">
                                        工装配备
                                    </button>
                                    <button *ngIf="permission.isGranted('Pages.Stock.Account.Record')" type="button" class="btn btn-default m--padding-left-5 m--padding-right-5"
                                        (click)="accountRecordModal.show(selectedAccounts[0])" [disabled]="selectedAccounts?.length != 1">
                                        工装室退库
                                    </button>
                                    <button *ngIf="permission.isGranted('Pages.Stock.Account.Record')" type="button" class="btn btn-default m--padding-left-5 m--padding-right-5"
                                        (click)="accountRecordModal.show(selectedAccounts[0])" [disabled]="selectedAccounts?.length != 1">
                                        工装室报销
                                    </button>
                                    <button *ngIf="permission.isGranted('Pages.Stock.Account.Record')" type="button" class="btn btn-default m--padding-left-5 m--padding-right-5"
                                        (click)="accountRecordModal.show(selectedAccounts[0])" [disabled]="selectedAccounts?.length != 1">
                                        工装盘点
                                    </button>
                                    <button *ngIf="permission.isGranted('Pages.Stock.Account.Record')" type="button" class="btn btn-default m--padding-left-5 m--padding-right-5"
                                    (click)="accountRecordModal.show(selectedAccounts[0])" [disabled]="selectedAccounts?.length != 1">
                                    丢失损坏下账
                                </button> -->
                                <!-- <button *ngIf="permission.isGranted('Pages.Stock.Account.Print')" (click)="createOrEditToolingReceiveBillModal.showList(selectedAccounts)"
                                    class="btn btn-default m--padding-left-5 m--padding-right-5" [disabled]="!selectedAccounts?.length >0"
                                    type="button">
                                    <i nz-icon type="printer" theme="outline"></i> 工装室领用
                                </button>
                                <button *ngIf="permission.isGranted('Pages.Stock.Account.Print')" (click)="createOrEditToolingBorrowBillModal.showList(selectedAccounts)"
                                    class="btn btn-default m--padding-left-5 m--padding-right-5" [disabled]="!selectedAccounts?.length >0"
                                    type="button">
                                    <i nz-icon type="printer" theme="outline"></i> 本单位借用
                                </button>
                                <button *ngIf="permission.isGranted('Pages.Stock.Account.Print')" (click)="createOrEditToolingBorrowOutBillModal.showList(selectedAccounts)"
                                    class="btn btn-default m--padding-left-5 m--padding-right-5" [disabled]="!selectedAccounts?.length >0"
                                    type="button">
                                    <i nz-icon type="printer" theme="outline"></i> 外单位借用
                                </button>
                                <button *ngIf="permission.isGranted('Pages.Stock.Account.Print')" (click)="createOrEditToolingScrapBillModal.showList(selectedAccounts)"
                                    class="btn btn-default m--padding-left-5 m--padding-right-5" [disabled]="!selectedAccounts?.length >0"
                                    type="button">
                                    <i nz-icon type="printer" theme="outline"></i> 工装室报废
                                </button>
                                <button *ngIf="permission.isGranted('Pages.Stock.Account.Record')" type="button" class="btn btn-default m--padding-left-5 m--padding-right-5"
                                    (click)="accountRecordModal.show(selectedAccounts[0])" [disabled]="selectedAccounts?.length != 1">
                                    交易记录
                                </button>
                                <button *ngIf="permission.isGranted('Pages.Stock.Account.Print')" (click)="printBillList()"
                                    class="btn btn-default m--padding-left-5 m--padding-right-5" [disabled]="!selectedAccounts?.length >0"
                                    type="button">
                                    <i nz-icon type="printer" theme="outline"></i> 台帐汇总打印
                                </button> -->
                            </div>
                        </div>

                        <div class="col-md-12 m--margin-top-20">
                            <p-table #dataTable (onLazyLoad)="getAccounts($event)" [value]="primengTableHelper.records"
                                     [rows]="primengTableHelper.defaultRecordsCountPerPage" [paginator]="false" [lazy]="true"
                                     [scrollable]="true" ScrollWidth="100%" [responsive]="primengTableHelper.isResponsive"
                                     [resizableColumns]="primengTableHelper.resizableColumns" selectionMode="multiple"
                                     [(selection)]="selectedAccounts" scrollHeight="{{scrollHeight}}">
                                <ng-template pTemplate="header">
                                    <tr>
                                        <th style="width: 40px">
                                            <p-tableHeaderCheckbox></p-tableHeaderCheckbox>
                                        </th>
                                        <th style="width: 40px">
                                            序号
                                        </th>
                                        <ng-container *ngFor="let ext of extensions">
                                            <th width="{{ ext.width }}">
                                                {{ ext.title }}
                                            </th>
                                        </ng-container>
                                    </tr>
                                </ng-template>

                                <ng-template pTemplate="body" let-record="$implicit" let-i="rowIndex">
                                    <tr [pSelectableRow]="record">
                                        <td style="width: 40px">
                                            <p-tableCheckbox [value]="record"></p-tableCheckbox>
                                        </td>
                                        <td style="width: 40px">
                                            {{ i + 1 + paginator.first }}
                                        </td>
                                        <ng-container *ngFor="let ext of extensions">
                                            <ng-container [ngSwitch]="ext.formatType">
                                                <ng-container *ngSwitchCase="1">
                                                    <td width="{{ ext.width }}">
                                                        {{ record[ext.key] | number: '1.0-0' }}
                                                    </td>
                                                </ng-container>
                                                <ng-container *ngSwitchCase="2">
                                                    <td width="{{ ext.width }}">
                                                        {{ record[ext.key] | number: '1.2-2' }}
                                                    </td>
                                                </ng-container>
                                                <ng-container *ngSwitchCase="4">
                                                    <td width="{{ ext.width }}">
                                                        {{ record[ext.key] | momentFormat: 'YYYY-MM-DD' }}
                                                    </td>
                                                </ng-container>
                                                <ng-container *ngSwitchDefault>
                                                    <td width="{{ ext.width }}">
                                                        {{ record[ext.key] }}
                                                    </td>
                                                </ng-container>
                                            </ng-container>
                                        </ng-container>
                                    </tr>
                                </ng-template>
                            </p-table>

                            <div class="primeng-no-data" *ngIf="primengTableHelper.totalRecordsCount == 0">
                                没有数据
                            </div>
                            <div class="primeng-paging-container">
                                <p-paginator [rows]="primengTableHelper.defaultRecordsCountPerPage" #paginator
                                             (onPageChange)="getAccounts($event)" [totalRecords]="primengTableHelper.totalRecordsCount"
                                             [rowsPerPageOptions]="primengTableHelper.predefinedRecordsCountPerPage">
                                </p-paginator>
                                <span class="total-records-count">
                                    {{ 'TotalRecordsCount' | localize: primengTableHelper.totalRecordsCount }}
                                </span>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <!--<createOrEditMiliOutBillModal #createOrEditMiliOutBillModal (modalSave)="getAccounts($event)"></createOrEditMiliOutBillModal>
    <createOrEditInventoryBillModal #createOrEditInventoryBillModal (modalSave)="getAccounts($event)" (accountShow)="simpleAccountBaseInfoModal.show()"
        stocktype="工装"></createOrEditInventoryBillModal>
    <simpleAccountBaseInfoModal #simpleAccountBaseInfoModal handletype="盘点" stocktype="工装" (modalSave)="createOrEditInventoryBillModal.addAccoutInfo($event)"></simpleAccountBaseInfoModal>
    <accountRecordModal #accountRecordModal></accountRecordModal>-->
    <!-- <baseFieldDetailModal #baseFieldDetailModal></baseFieldDetailModal>
    <createOrEditToolingReceiveBillModal #createOrEditToolingReceiveBillModal (modalSave)="getAccounts($event)"></createOrEditToolingReceiveBillModal>
    <createOrEditToolingBorrowBillModal #createOrEditToolingBorrowBillModal (modalSave)="getAccounts($event)"></createOrEditToolingBorrowBillModal>
    <createOrEditToolingBorrowOutBillModal #createOrEditToolingBorrowOutBillModal (modalSave)="getAccounts($event)"></createOrEditToolingBorrowOutBillModal>
    <createOrEditToolingScrapBillModal #createOrEditToolingScrapBillModal (modalSave)="getAccounts($event)"></createOrEditToolingScrapBillModal> -->
</div>
